package com.dean.pokeking.ui.pages

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.Button
import androidx.compose.material.Text
import androidx.compose.material.TextField
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import com.dean.pokeking.beans.PlayerList


@Composable
fun MonsterEditPage(
    editPlayerList: PlayerList,
    confirm: (PlayerList) -> Unit
) {
    var newNote by remember(editPlayerList) {
        mutableStateOf(editPlayerList.note)
    }
    Box(modifier = Modifier.fillMaxSize().background(color = Color.Black.copy(alpha = 0.8f))) {
        Column(modifier = Modifier
            .background(color = Color.White)
            .fillMaxWidth()) {
            TextField(value = newNote ?: "", onValueChange = { newNote = it })
            Button(modifier = Modifier.fillMaxWidth(), onClick = { confirm(editPlayerList.copy(note = newNote)) }) {
                Text(text = "确认")
            }
        }
    }
}